/*
 *
 * Copyright 2018-2020,2022-2023 NXP.
 *
 * NXP Confidential. This software is owned or controlled by NXP and may only be
 * used strictly in accordance with the applicable license terms. By expressly
 * accepting such terms or by downloading,installing, activating and/or otherwise
 * using the software, you are agreeing that you have read,and that you agree to
 * comply with and are bound by, such license terms. If you do not agree to be
 * bound by the applicable license terms, then you may not retain, install, activate
 * or otherwise use the software.
 *
 */

#ifndef UWBAPI_PROPRIETARY_INTERNALH
#define UWBAPI_PROPRIETARY_INTERNALH

#ifdef __cplusplus
extern "C" {
#endif

#include "phUwbTypes.h"
#include <UwbApi_Types_Proprietary.h>
#include "PrintUtility.h"

#define TX_POWER_DIFF_LEN                                  3u
#define FREQUENCY_DIFF_LEN                                 6u
#define ANTENNA_DELAY_LEN                                  3u
#define CURRENT_LIMIT_VALUE_LEN                            1u
#define TEMP_COMPENS_FLAG_LEN                              1u
#define TX_ADAPTIVE_POWER_LEN                              3u
#define DDFS_TONE_CONFIG_LEN                               72u
#define DPD_TIMER_PENALTY_US_LEN                           4u
#define TRIM_BACKOFF_PREAMBLE_10_LEN                       1u
#define TRIM_BACKOFF_PREAMBLE_27_LEN                       1u
#define LUT_TEMP_LEN                                       4u
#define LUT_XTAL_LEN                                       4u
#define TEMPERATURE_SOURCE_LEN                             1u
#define THERMISTOR_RP_LEN                                  4u
#define WAKEUP_SENSOR_ENABLE_LEN                           1u
#define SLOW_BLINK_INTERVAL_LEN                            2u
#define TRIM_LOCK_LEN                                      4u
#define CUSTOM_LUT_ENBL_LEN                                1u
#define LUT_TEMP_RT_OFFSET_LEN                             2u
#define LUT_TEMP_RT_SLOPE_LEN                              2u
#define TRIM_PREAMBLE_10_27_PAYLOAD_PS_COEFFS_OVERRIDE_LEN 1u
#define MODULE_MAKER_ID_LEN                                2u

EXTERNC uint8_t getExtTLVBuffer(uint8_t paramId, void *paramValue, uint8_t *tlvBuffer);

/**
 **
 ** Function:        extDeviceManagementCallback
 **
 ** Description:     Receive device management events from stack for
 **                  Proprietary Extensions
 **                  dmEvent: Device-management event ID.
 **                  eventData: Data associated with event ID.
 **
 ** Returns:         None
 **
 */
EXTERNC void extDeviceManagementCallback(uint8_t gid, uint8_t event, uint16_t paramLength, uint8_t *pResponseBuffer);
EXTERNC BOOLEAN parseDeviceInfo(phUwbDevInfo_t *pdevInfo);
EXTERNC void formCalibrationCommand(
    uint8_t paramId, void *pCalibData, uint8_t *pSetCalibrationCmd, uint16_t *pCommandLength);
EXTERNC bool formTestModeCommand(
    eTestMode testMode, const phTestModeParams *testModeParams, uint8_t *pCommand, uint16_t *pCommandLength);

/**
 **
 ** Function:        setDefaultCoreConfigs
 **
 ** Description:     Sets all core configs. Default values are picked from
 **                  config file(phNxpUciHal_RhodesConfig.h)
 **
 ** Returns:         None
 **
 */
EXTERNC tUWBAPI_STATUS setDefaultCoreConfigs(void);

/**
 **
 ** Function:        getExtCoreDeviceConfigTLVBuffer
 **
 ** Description:     Convert one TLV Application Configuration Structure to Byte
 **                  Array for Ext Core Device configs.
 **
 ** Returns:         Length of the data
 **
 */
EXTERNC uint8_t getExtCoreDeviceConfigTLVBuffer(
    uint8_t paramId, uint8_t paramLen, void *paramValue, uint8_t *tlvBuffer);

/**
 **
 ** Function:        parseExtGetDeviceConfigResponse
 **
 ** Description:     Convert received UCI response to deviceConfig object
 **
 ** Returns:         None
 **
 */
EXTERNC void parseExtGetDeviceConfigResponse(uint8_t *tlvBuffer, phDeviceConfigData_t *devConfig);

/**
 **
 ** Function:        UpdateRadioSettings
 **
 ** Description:     Update the Radio configs for SR040
 **
 ** Returns:         Status
 **
 */
EXTERNC tUWBAPI_STATUS UpdateRadioSettings(uint8_t index, const uint8_t *pValue, uint16_t size, uint16_t crc);
EXTERNC void ufaDeviceManagementNtfCallback(uint8_t gid, uint8_t oid, uint16_t len, uint8_t *eventData);

#ifdef __cplusplus
} // closing brace for extern "C"
#endif

#endif // UWBAPI_PROPRIETARY_INTERNALH
